/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Máté
 */

// Jelgenerátort megvalósító osztály
public class Generator extends Source {

    private Integer index;

    // generátor bitsorozata
    private List<Boolean> pattern;

    public Generator() {
        super();
        this.index = new Integer(0);
        this.pattern = new ArrayList<Boolean>();
    }

    // generátor léptetése
    public void step() {
        ResetHandler.reset();

        this.index++;
        if (this.index == this.pattern.size()) {
            this.index = 0;
        }

        getOutput().update(this.pattern.get(this.index));
        ScopeWatch.runOscilloscope();
    }

    public void setPattern(List<Boolean> list) {
        this.pattern = list;
        this.index=list.size()-1;
    }
}
